import Vue from 'vue'
import VueRouter from 'vue-router'
import LoginView from "@/views/LoginView.vue";
import RegisterView from "@/views/RegisterView.vue";
import IndexView from "@/views/IndexView.vue";
import UserView from "@/views/UserView.vue";
import StudentView from "@/views/StudentView.vue";
import ScoreView from "@/views/ScoreView.vue";

Vue.use(VueRouter)

//  路由列表    to   组件的映射关系表
const routes = [
  {
    path: '/',
    name: 'login',
    component: LoginView
  },
  {
    path: '/register',
    name: 'register',
    component: RegisterView
  },
  {
    path: '/index',
    name: 'index',
    redirect:'/index/user',   //  路径重定向
    component: IndexView,
    children:[
      {
        path: 'user',
        name: 'user',
        component: UserView
      },
      {
        path: 'student',
        name: 'student',
        component: StudentView
      },
      {
        path: 'score',
        name: 'score',
        component: ScoreView
      }
    ]
  }
]

const router = new VueRouter({
  routes
})

export default router
